<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<%@ include file="../common/taglibs.jsp"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>结算查询</title>
    <link rel="icon" href="favicon.ico" type="image/x-icon"/>
    <!-- 当前页面样式 -->
    <link rel="stylesheet" href="<s:url value="/css/common.css"/>"/>
    <!-- 当前页面样式 END -->
    <script type="text/javascript" src="<c:url value="/js/jquery-1.3.2.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/common.js" />"></script>
	<script type="text/javascript" src="<c:url value="/js/My97DatePicker/WdatePicker.js"/>"></script>
	<script type="text/javascript">
	//查询结算信息
		function queryCheck(){
			/* if(timeCheck()){ */
				$("#queryUserForm").attr("action","<%=basePath%>/settlementmsg/querySettleMsgList.ct")
				$("#queryUserForm").submit();
				$("#queryBtnId").attr("disabled","true");
			/* } */
			
		}
	//导出excel	
		function exportCheck(){
			/* if(timeCheck()){ */
				$("#queryUserForm").attr("action","<%=basePath%>/settlementmsg/exportSettleMsgList.ct")
				$("#queryUserForm").submit();
			/* } */
		}
		
		
		//表单条件校验
		function timeCheck(){
			var minDate = $.trim($("#minDate").val());
			var maxDate = $.trim($("#maxDate").val());
			
			if(!minDate || !maxDate ){
				alert("请选择时间范围");
				return false;
			}
			
			var date1=str2date(minDate);
			var date2=str2date(maxDate);
			
			if(date1.getMonth()!=date2.getMonth()){
			    alert("选择的时间范围不在同一个月内！");
				return false;
			}
			
			return true;
		}
		
		
		//字符串转时间
		function   str2date(str){   
			var   d=null;   
			var   reg=/^(\d{4})(\d{2})(\d{2})$/  ;
			if(arr=str.match(reg)) d=new Date(Number(arr[1]),Number(arr[2])-1,Number(arr[3])) ; 
			return   d;   
		}
		
	</script>
</head>
<body>
<s:form id="queryUserForm" action="" method="post" theme="simple">
<table class="tb">
    <tbody>
        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h2">POS收单运营管理平台</div></td>
        </tr>

        <tr class="tb-line">
            <td class="tb-td" colspan="4"><div class="tb-h3">结算查询</div></td>
        </tr>

        <tr class="tb-line">
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">结算起始日期：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-mini"><input id="minDate"  value="<c:if test='${searchCondition.minDate !=null }'>${searchCondition.minDate }</c:if>" name="searchCondition.minDate" type="text"  onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"/></label>至<label class="tb-input-mini"><input type="text" id="maxDate" name="searchCondition.maxDate" value="<c:if test='${searchCondition.maxDate !=null }'>${searchCondition.maxDate }</c:if>" onfocus="WdatePicker({dateFmt:'yyyyMMdd',readOnly:true,wdate:true,errDealMode:0});"/></label><code class="asterisk">*</code>
            </td>
            <td align="right" class="tb-td">
                <div class="tb-h4">商户号：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><input type="text" id="businessNum" name="searchCondition.businessNum" value="<c:if test='${searchCondition.businessNum != null }'>${searchCondition.businessNum }</c:if>" /></label>
            </td>
        </tr>
        <tr class="tb-line">
        	<td align="right" class="tb-td">
                <div class="tb-h4">商户简称：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><input type="text" id="businessName" name="searchCondition.businessName" value="<c:if test='${searchCondition.businessName != null }'>${searchCondition.businessName }</c:if>" /></label>
            </td>
            <td align="right" class="tb-td">
                <div class="tb-h4">机构代码：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal"><input type="text" id="insIdCd" name="searchCondition.insIdCd" value="<c:if test='${searchCondition.insIdCd != null }'>${searchCondition.insIdCd }</c:if>" /></label>
            </td>
        </tr>
        <tr class="tb-line">
        	<td align="right" class="tb-td">
                <div class="tb-h4">冻结状态：</div>
            </td>
            <td class="tb-td">
                <label class="tb-input-normal">
                	<s:select list="#{'':'请选择状态',0:'未冻结',1:'冻结' }" name="searchCondition.freezeFlag" />
			   </label>
            </td>
            
            <td width="12%" style="min-width: 150px" align="right" class="tb-td">
                <div class="tb-h4">结算类型：</div>
            </td>
            <td class="tb-td">
 				<label class="tb-select">
				 <s:select name="searchCondition.type" list="#{'0':'普通交易结算','1':'扫码结算','5':'云商宝自营'}" headerKey="" headerValue="不限" cssClass="queryWidth" id="orgCode"/> 
                </label>
             </td>
            
        </tr>

        <tr class="tb-line">
            <td class="tb-td line-submit" align="right" colspan="4">
                <label class="tb-input-submit">
                    <input id="queryBtnId" type="button" value="查询" onclick="return queryCheck();"/>
                </label>
                 <label class="tb-input-submit">
                	<s:if test="#request.settleList != null && #request.settleList.size>0">
					   		<input id="szPower" type="button"
							value="导 出" onclick="return exportCheck();"/>
					   
					</s:if>
					<s:else>
					 	<input id="szPower" disabled="disabled" value="导  出" type="button" /> 
					</s:else>
                </label> 
            </td>
        </tr>
        <tr class="tb-line">
         		<td class="tb-td line-submit" align="center" colspan="4">
         			<font color="red" id="msgInfo"><s:actionmessage/>
         				
		               	统计：当前查询条件金额共计[<font color="red"><s:property value="#request.settleAmtTotal"/></font>]，笔数[<font color="red"><s:property value="#request.totalNumTotal"/></font>]
		               	
         			</font>
         		</td>
         </tr>
        <s:if test="#request.settleList != null && #request.settleList.size>0">
			<tr class="tb-line">
				<td class="tb-td paging"  align="left" colspan="4"> <page:pageCount
								max_pages="11" totalPage="${requestScope.totalPage}"
								currentPage="${requestScope.currentPage}"
								action="${rootPath}/settlementmsg/querySettleMsgList.ct?currentPage=" />

				</td>
			</tr>
		</s:if>
    </tbody>
</table>

<div class="big-tb">
    <table class="tb" style="width: 100%;">
        <thead>
            <tr class="tb-line">
                <th class="tb-th" colspan="15">结算信息列表</th>
            </tr>
            <tr class="tb-line bg-gray">
                <th class="tb-th">商户号</th>
                <th class="tb-th">商户名称</th>
                <th class="tb-th">开户账号</th>
                <th class="tb-th">开户名称</th>
                <th class="tb-th">开户行行号</th>
                <th class="tb-th">开户行名称</th>
                <th class="tb-th">交易本金</th>
                <th class="tb-th">结算金额</th>
                <th class="tb-th">商户手续费</th>
                <th class="tb-th">结算类型</th>
                <th class="tb-th">结算日期</th>
                <th class="tb-th">结算周期</th>
                <th class="tb-th">结算方式</th>
                <th class="tb-th">机构代码</th>
                <th class="tb-th">收单机构代码</th>
                
            </tr>
        </thead>
        <tbody>
			<s:iterator value="#request.settleList" status="stat" id="tft">
				<tr  class="tb-line"  >
					
						<td class="tb-td"><s:property value="#tft.mchtCd"/></td>
						<td class="tb-td"><s:property value="#tft.mchtName"/></td>
						<td class="tb-td"><s:property value="#tft.account"/></td>
						<td class="tb-td"><s:property value="#tft.accountName"/></td>
						<td class="tb-td"><s:property value="#tft.bankCode"/></td>
						<td class="tb-td"><s:property value="#tft.bankName"/></td>
						<td class="tb-td"><s:property value="#tft.transAmt"/></td>
						<td class="tb-td"><s:property value="#tft.mchtSetAmt"/></td>
						<td class="tb-td"><s:property value="#tft.mchtFee"/></td>
						<td class="tb-td"><s:property value="#tft.typeName"/></td>
						<td class="tb-td"><s:property value="#tft.settleDate"/></td>
						<td class="tb-td">日结</td>
						<td class="tb-td">轧差</td>
						<td class="tb-td"><s:property value="#tft.insIdCd"/></td>
						<td class="tb-td"><s:property value="#tft.insCompanyCd"/></td>
				</tr>
			</s:iterator>
        </tbody>
    </table>
</div>
</s:form>
</body>
</html>